package com.igbeok.miscellaneous.concurrency.thij;

public class Chef3 extends Thread {
	private Restaurant restaurant;
	private Object obj;
//	private WaitPerson3 waitPerson;

	public Chef3(String name, Restaurant restaurant, Object obj) {
		super(name);
		this.restaurant = restaurant;
		this.obj = obj;
//		this.waitPerson = waitPerson;
	}

	public void run() {
		while (true) {
			// while (restaurant.orders.size() < 100) {
			
			synchronized (obj) {
				restaurant.orders.add(new Order2());
				System.out.println("Order就绪, 通知大家");
				obj.notifyAll();
			}
			// }
		}
	}
}
